package org.halk.spring_cloud_stream_demo;

import com.rabbitmq.http.client.domain.UserInfo;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @Author halk
 * @Date 2021/9/6 0006 16:24
 * @desc
 */
public class Demo {

    public static void main(String[] args) {
        String strUserIds = "u/1/nn,u/2/bb";
        String all = "u/1/nn,u/2/bb,u/3/cc";
        List<String> selectUserList = Arrays.stream(strUserIds.split(",")).collect(Collectors.toList());
        List<String> userListAll = Arrays.stream(all.split(",")).collect(Collectors.toList());
        userListAll.removeAll(selectUserList);

        userListAll.forEach(System.out::println);
    }

    @Test
    public void test01() {
        ArrayList<Integer> list = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5));
        for (int i = list.size() - 1; i >= 0; i--) {
            list.remove(i);
        }
        System.out.println(list.size());
    }
}
